package com.goods.controller;

import com.goods.entity.GoodsCategory;
import com.goods.model.ResponseData;
import com.goods.service.GoodsCategoryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.*;

/**
 * 商品类别接口
 * @author huangyanzhong
 * @date 2020-04-01
 */
@Controller
@RequestMapping("/goodsCategory")
public class GoodsCategoryController extends BaseController {

    private Logger logger=LoggerFactory.getLogger(getClass());

    @Autowired
    GoodsCategoryService goodsCategoryService;

    /**
     * 获取所有商品类别
     * @param
     * @return
     */
    @GetMapping("/getAll")
    @ResponseBody
    public Object getAll() {
        try {
            List<GoodsCategory> rows=goodsCategoryService.getAll();
            return rows;
        }catch (Exception e){
            logger.error(e.getMessage());
            return new ArrayList<>();
        }
    }

}